//
//  SCNavigationController.m
//  shangcheng
//
//  Created by 张艳江 on 2019/5/28.
//  Copyright © 2019 张艳江. All rights reserved.
//

#import "SCNavigationController.h"

@interface SCNavigationController ()

@end

@implementation SCNavigationController

+ (void)initialize{
    
    // 取出appearance对象
    UINavigationBar *navBar = [UINavigationBar appearance];
    // 设置标题属性
    NSMutableDictionary *textAttrs = [NSMutableDictionary dictionary];
    textAttrs[NSForegroundColorAttributeName] = RGB(51, 51, 51);
    textAttrs[NSFontAttributeName] = SCFont(16);
    [navBar setTitleTextAttributes:textAttrs];
    
    // 设置背景
    [navBar setShadowImage:[UIImage new]];
    [navBar setBackgroundImage:[UIImage imageWithColor:[UIColor whiteColor]] forBarMetrics:UIBarMetricsDefault];
}

- (void)viewDidLoad {
    [super viewDidLoad];
}
- (void)pushViewController:(UIViewController *)viewController animated:(BOOL)animated{
    if (self.viewControllers.count > 0) {
        viewController.navigationItem.leftBarButtonItem = [UIBarButtonItem barButtonItemWithImage:[UIImage imageNamed:@"back"] target:self action:@selector(back)];
        viewController.hidesBottomBarWhenPushed = YES;
    }
    [super pushViewController:viewController animated:YES];
}
- (void)back{
    [self popViewControllerAnimated:YES];
}

@end
